﻿using FakeXiecheng.API.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace FakeXiecheng.API.Services
{
    public class MockTouristRouteRepository : ITouristRouteRepository
    {
        private List<TouristRoute> _routes;
        public MockTouristRouteRepository()
        {
            if (_routes == null)
            {
                InitializeTouristRoutes();
            }
        }

        private void InitializeTouristRoutes()
        {
            _routes = new List<TouristRoute> {
                new TouristRoute {
                    Id=Guid .NewGuid(),
                    Title ="黄山",
                    Description="真好玩",
                    OriginalPrice=299,
                    Features="<p>吃完大幅度</p>",
                    Fees ="家通风",
                   Notes ="小心危险"
                },
                new TouristRoute {
                    Id=Guid .NewGuid(),
                    Title ="泰山",
                    Description="泰山好高",
                    OriginalPrice=399,
                    Features="<p>吃完大幅度</p>",
                    Fees ="家通风",
                   Notes ="小心危险"
                }
            };
        }


        public IEnumerable<TouristRoute> GetTouristRoutes()
        {
            return _routes;
        }

        public TouristRoute GetTouristRoute(Guid touristRouteId)
        {
            //linq
            return _routes.FirstOrDefault(n => n.Id == touristRouteId);
        }


    }
}
